Journal: PLoS ONE
Article Title: Algorithmic differentiation improves the computational efficiency of OpenSim-based trajectory optimization of human movement
doi: 10.1371/journal.pone.0217730
Figure Lengend Snippet: We developed two approaches (AD-ADOLC and AD-Recorder) to make an OpenSim function F and its forward ( F fwd ) and reverse ( F rev ) directional derivatives available within the CasADi environment for use by the NLP solver during the optimization. In the AD-ADOLC approach (top), ADOL-C’s algorithms are used in a C++ code to provide F fwd and F rev . In the AD-Recorder approach (bottom), Recorder provides the expression graph of F as MATLAB source code from which CasADi’s C-code generator generates C-code containing F , F fwd , and F rev . The AD-Recorder approach combines operator overloading, when generating the expression graph, and source code transformation, when processing the expression graph to generate C-code for F , F fwd , and F rev . In both approaches, the code comprising F , F fwd , and F rev is compiled as a Dynamic-link Library (DLL), which is imported as an external function within the CasADi environment. In our application, F represents the multi-body dynamics and is called when formulating the optimal control problem. The latter is then composed into a differentiable optimal control transcription using CasADi. During the optimization, CasADi provides the NLP solver with evaluations of the NLP objective function ( nlp f ), constraints ( nlp g ), objective function gradient ( nlp grad f ), constraint Jacobian ( nlp jac g ), and Hessian of the Lagrangian ( nlp hess l ). CasADi efficiently queries F fwd and F rev to construct the full derivative matrices.
Article Snippet: Examples of AD tools using source code transformation are ADiGator for MATLAB [ ] and CasADi that is available for C++, Python, and MATLAB [ ].
Techniques: Expressing, Transformation Assay, Control, Construct